# -*- coding: utf-8 -*-
from simple import Simple
import fuse

fuse.fuse_python_api = (0, 2)

def readdir(path, list_path):
	result = ['.', '..']
	if path != "/":
		path = path + "/"
	for i in list_path:
		if i.startswith (path):
			name = i.partition (path)[2]
			if (name.find('/') == -1):
				result.append(path + name)
		yield result

if __name__ == '__main__':
	
	list_path = ['alex/home/pitongrande/asdfasd/asdf',
			'alex/home/pitongrande/asdfasd',
			'alex/home/pitongrande/asdfasd/fad/gfda',
			'alex/home/pitongrande/control',
			'alex/home/pitongrande/washadnwear'
			]
	
	path = 'alex/home/pitongrande'
	
	fs = Simple()
	fs.open_log()
	
	fs.debug1('lalalalalalalalalala %s', path)
	
	result = readdir(path, list_path)
	for i in range(0, 2):
		print result.next()
		
	for i in path[1:]:
		print i
	